package com.comac.print.component.app.domain.gateway.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @Description 适航标注标识
 * @Author yy
 * @Date 2022/4/19 13:54
 */
public enum AirworthinessAnnotationFlagEnum {
    UN_MARK("00", "未标注"),
    MARKED("01", "已标注"),
    QUALITY_ASSURANCE_INSPECTION("02", "质保检查已完成"),
    AIRWORTHINESS_INSPECTION("03", "适航检查已完成"),
    NULL(null, "未设置");

    @Getter
    @Setter
    private String code;
    @Getter
    @Setter
    private String description;

    AirworthinessAnnotationFlagEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 通过code获取枚举值
     *
     * @param code
     * @return
     */
    public static AirworthinessAnnotationFlagEnum getAirworthinessAnnotationFlagEnumByCode(String code) {
        return Arrays.stream(AirworthinessAnnotationFlagEnum.values())
                .filter(airworthinessAnnotationFlagEnum -> airworthinessAnnotationFlagEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
